package com.zenFlower.wechat.controller;

import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpMenuService;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.menu.WxMpMenu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2017/4/19.
 */
@RestController
public class WechatMenuController {

    @Autowired
    WxMpService wxMpService;

    @RequestMapping("/getWeChatMenu")
    public WxMpMenu getMenu(){
        WxMpMenu menu = null;
        try {
            menu = wxMpService.getMenuService().menuGet();
        } catch (WxErrorException e) {
            e.printStackTrace();
        }
        return menu;
    }
}
